//
//  SCImageCollectionViewCell.m
//  LastOne
//
//  Created by dllo on 15/11/7.
//  Copyright © 2015年 sc. All rights reserved.
//

#import "SCImageCollectionViewCell.h"
#import "FitHeader.h"
@interface SCImageCollectionViewCell ()

@property(nonatomic, assign)CGRect rect;

@end

@implementation SCImageCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.rect = frame;
        
        _imageView = [[UIImageView alloc] initWithFrame:self.contentView.frame];
        [self addSubview:_imageView];
        
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:15 * FitWidth];
        _nameLabel.backgroundColor = [UIColor clearColor];
        _nameLabel.textColor = [UIColor whiteColor];
        [self addSubview:_nameLabel];
        
        _ennameLabel = [[UILabel alloc] init];
        _ennameLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:13 * FitWidth];
        _ennameLabel.backgroundColor = [UIColor clearColor];
        _ennameLabel.textColor = [UIColor whiteColor];
        [self addSubview:_ennameLabel];
    }
    return self;
}

-(void)setKind:(NSInteger)kind
{
    switch (kind) {
        case 0:
            _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.width * 0.6)];
            _nameLabel.frame = CGRectMake(5 * FitWidth, self.rect.size.height * 0.6, self.rect.size.width - 10 * FitWidth, self.frame.size.width * 0.2);
            _nameLabel.textColor = [UIColor blackColor];
            _ennameLabel.frame = CGRectMake(5 * FitWidth, self.rect.size.height *0.8, self.rect.size.width - 10 * FitWidth, self.frame.size.width * 0.2);
            _ennameLabel.textColor = [UIColor grayColor];
            break;
        case 1:
            _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
            break;
            
        default:
            break;
    }
}

-(void)setNameString:(NSString *)nameString
{
    _nameString = nameString;
    
    _nameLabel.frame = CGRectMake(5 * FitWidth, self.rect.size.height - 50 * FitHeight, self.rect.size.width, 25 * FitHeight);
    _nameLabel.text = nameString;
}

-(void)setEnnameString:(NSString *)ennameString
{
    _ennameString = ennameString;
    
    _ennameLabel.frame = CGRectMake(5 * FitWidth, self.rect.size.height - 25 * FitHeight, self.rect.size.width, 15 * FitHeight);
    _ennameLabel.text = ennameString;
}


@end
